//
// Created by 吴锐 on 2022/2/27.
//

#include "iostream"

using namespace std;

class Person {
public:
    string m_Name;
    int m_Age;

    Person(string name, int age) {
        this->m_Name = name;
        this->m_Age = age;
    }
};

template<class T>
bool myCompare(T &a, T &b) {
    if (a == b) {
        return true;
    } else {
        return false;
    }
}

template<> bool myCompare(Person &p1, Person &p2){
    if(p1.m_Name == p2.m_Name && p1.m_Age == p2.m_Age){
        return true;
    }else {
        return false;
    }
}

void test01() {
    int a = 10;
    int b = 20;
    bool result = myCompare(a, b);
    if (result) {
        cout << "a == b" << endl;
    } else {
        cout << "a != b" << endl;
    }
}

void test02() {
    Person p1("Tom", 10);
    Person p2("Tom", 10);
    bool result = myCompare(p1, p2);
    cout << (result == true ? "p1 == p2" : "p1 != p2") << endl;
}

int main() {
//    test01();
    test02();
    return 0;
}